        var range = 600;             //距下边界长度/单位px  
        var elemt = 300;           //插入元素高度/单位px  
        var maxnum = 'no';            //设置加载最多次数  
        var num = 2;  
        var totalheight = 0;  
        var PAGESIZE= 15;  	
		var type= 0; 
 $(document).ready(function(){  
		load_water(1,15,0,1);
        var all_list = $("#all_list");                     //主体元素  
        $(window).scroll(function(){  
            var srollPos = $(window).scrollTop();    //滚动条距顶部距离(页面超出窗口的高度)  
              
            //console.log("滚动条到顶部的垂直高度: "+$(document).scrollTop());  
            //console.log("页面的文档高度 ："+$(document).height());  
            //console.log('浏览器的高度：'+$(window).height());  
              
            totalheight = parseFloat($(window).height()) + parseFloat(srollPos);
            if(($(document).height()-range) <= totalheight  && num != maxnum) {  
                
				$(".more-btn").removeClass("hide");
				load_water(num,PAGESIZE,0,0);
                num++;  
            }  
        }); 

    $("#today").click(function() {
		$("#list_1").removeClass("hide");
  //       $('#pay').attr('class', 'button margin-bottom12 jz-flex-col');
		// $('#cash').attr('class', 'button button-gray button-f7 jz-flex-col');
		// $("#cash_tips").addClass("hide");
		load_water(1,15,1,1,0);
    });

    $("#total").click(function() {
		$("#list_1").removeClass("hide");
  //       $('#cash').attr('class', 'button margin-bottom12 jz-flex-col');
		// $('#pay').attr('class', 'button button-gray button-f7 jz-flex-col');
		// $("#cash_tips").removeClass("hide");
		load_water(1,15,1,1,1);
    });
 });  
function load_water(num,PAGESIZE,ifempty,isnull,iftotal){
	    $.ajax({
        type : "POST",
        url : "/wap/user/history_refresh",
        data : "page=" + num + "&pagesize=" + PAGESIZE + "&iftotal="+iftotal,
        datatype : 'JSON',
        async : true,
        beforeSend: function() {
           /* showLoading('载入中...');*/
        },
        success : function(response) {
            // alert( response );
            // alert( response.list.length );
            if( ifempty == 1 )
            {
                $(".list_data").html("");
            }

			$(".more-btn").addClass("hide");
			//hideLoading(); 
            for( var i in response )
            {
                //alert( i+"\n"+response[i] );
            }
			if(response.status==1){
				if(isnull==1){
					$(".list_data").html('<dl><dt class="list_head"><span>到期时间</span><span>资产类型</span><span>涨/跌</span><span>买入金额</span><span>盈利情况</span><span>订单状态</span></dt><div id="list0" class="list_ajax"></div></dl>');
					$(".com-empty").addClass("hide");
				}
				$.each(response.list, function(key, value) {
                //  alert(value.cash_type==1);
                //$("#all_page").append('<div class="J_zclx"> <h4 class="L_J_zclx">' + value.cash_type + ' ￥' + value.amount + '<span class="J_Tmoney">' + value.auth_state + '</span></h4><div class="ui-block-a J_block01 J_border_B L_J_zclx01"><h5>' + value.create_time + '&nbsp&nbsp&nbsp' + value.cash + '&nbsp&nbsp&nbsp流水号：' + value.id + '</h5></div></div>');
				    $(".list_ajax").append('<dt class="rec-tr" onclick="get_history(\''+value.id+'\',this)" id="'+value.id+'"><span>'+value.trade_time+'</span><span>'+value.option_key+'</span><span>'+value.trade_direction+'</span><span>'+value.trade_amount+'</span><span>'+value.profit+'</span><span>'+value.is_win+'</span></dt>');
				});
			}else{
				num==maxnum;
				if(num==1){
					$("#list_1").addClass("hide");
					$(".come-txt").text("您还没有任何记录");
					$(".com-empty").removeClass("hide");
				}else{
					$(".come-txt").text("没有更多记录");
					$(".com-empty").removeClass("hide");
				}
				return false; 
			}
        },
            error: function() {
                hideLoading();
            },
            complete: function() {
                //hideLoading()
            }
        //  "json");
    });
}
function get_history(id,obj) {
    return false;
	window.location.href =ROOT+"/wap/user/get_history/id/"+id+".html"; 
}